<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Products extends Model
{
    use HasFactory;

    protected $fillable = ['category_id', 'build_type_id', 'name', 'desc', "tag", "img_list", "introduction", "usage", "params", "name_en", "tag_en", "desc_en", "introduction_en", "usage_en", "params_en"];

    public function productsCategories()
    {
        return $this->belongsTo(ProductsCategories::class, 'category_id', 'id');
    }

    public function projects()
    {
        return $this->hasMany(Projects::class, 'product_id', 'id');
    }

    public function buildType()
    {
        return $this->belongsTo(BuildType::class, 'build_type_id', 'id');
    }
}


